<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">

<head>

    <meta charset="utf-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>


    <title>H+ 后台主题UI框架 - 数据表格</title>
    <meta name="keywords" content="H+后台主题,后台bootstrap框架,会员中心主题,后台HTML,响应式后台"/>
    <meta name="description" content="H+是一个完全响应式，基于Bootstrap3最新版本开发的扁平化主题，她采用了主流的左右两栏式布局，使用了Html5+CSS3等现代技术"/>

    <link rel="shortcut icon" href="favicon.ico"/> <link href="css/bootstrap.min.css?v=3.3.6" rel="stylesheet"/>
    <link href="css/font-awesome.css?v=4.4.0" rel="stylesheet"/>

    <!-- Data Tables -->
    <link href="css/plugins/dataTables/dataTables.bootstrap.css" rel="stylesheet"/>

    <link href="css/animate.css" rel="stylesheet"/>
    <link href="css/style.css?v=4.1.0" rel="stylesheet"/>

</head>

<body class="gray-bg">
    <div class="wrapper wrapper-content animated fadeInRight">
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>基本 <small>系统管理，角色管理</small></h5>
                        <div class="ibox-tools">
                            <a class="collapse-link">
                                <i class="fa fa-chevron-up"></i>
                            </a>
                            <a class="dropdown-toggle" data-toggle="dropdown" href="table_data_tables.html#">
                                <i class="fa fa-wrench"></i>
                            </a>
                            <ul class="dropdown-menu dropdown-user">
                                <li><a href="table_data_tables.html#">选项1</a>
                                </li>
                                <li><a href="table_data_tables.html#">选项2</a>
                                </li>
                            </ul>
                            <a class="close-link">
                                <i class="fa fa-times"></i>
                            </a>
                        </div>
                    </div>

                    <div class="ibox-content">
                        <table class="table table-striped table-bordered table-hover">
                            <tbody>
                            <tr class="gradeX">
                                <td>
                                    <form class="navbar-form navbar-left" role="search" method="post" action="getselective">
                                        <div class="form-group">
                                            <input type="hidden" name="roleid" class="form-control" th:value="${wl_user_role_bean.id}" />

                                            角色名称:<input type="text" readonly="readonly" class="form-control" th:value="${wl_user_role_bean.rolename}" />

                                            角色编码:<input type="text" readonly="readonly" class="form-control" th:value="${wl_user_role_bean.rolecode}"/>

                                            <br/>
                                        </div>
                                    </form>
                                </td>
                            </tr>
                            </tbody>
                        </table>
                    </div>

                    <div class="ibox-content">

                        <table class="table table-responsive table-striped table-bordered table-hover dataTables-example">
                            <thead>
                                <tr>
                                    <th></th>
                                    <th>序号</th>
                                    <th>权限名称</th>
                                    <th>权限编码/th>
                                    <th>资源URL</th>
                                </tr>
                            </thead>

                            <tbody>
                                <tr th:each="comp:${wl_user_competence_list}" class="gradeX">

                                    <td id="check">
                                        <input type="checkbox" onclick="par(this)" id="competencename" name="competencename" th:if="${comp.index == 1}" th:value="${comp.id}" checked="checked">
                                        <input type="checkbox" onclick="par(this)" id="competencename" name="competencename" th:if="${comp.index != 1}" th:value="${comp.id}">
                                    </td>
                                    <td id="id" th:text="${comp.id}"></td>
                                    <td th:text="${comp.competencename}"></td>
                                    <td th:text="${comp.competencecode}"></td>
                                    <td th:text="${comp.url}"></td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <div class="modal inmodal" id="myModal" tabindex="-1" role="dialog" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content animated bounceInRight">
                <h3>编辑角色信息</h3>
                <hr>
                <div class="modal-header">
                    <input type="hidden" name="id">
                    <label class="col-sm-2 control-label">名称：</label><input type="text"  name="rolename" class="form-control" style="width: 400px;border-radius: 4%;"/><br>
                    <label class="col-sm-2 control-label">编码：</label><input type="text" name="rolecode" class="form-control" style="width: 400px;border-radius: 4%;"/><br>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-white" id="guanb" data-dismiss="modal">关闭</button>
                    <button type="button" onclick="update()" id="updbutton" class="btn btn-primary">保存</button>
                </div>
            </div>
        </div>
    </div>

    <!-- 全局js -->
    <script src="js/jquery.min.js?v=2.1.4"></script>
    <script src="js/bootstrap.min.js?v=3.3.6"></script>



    <script src="js/plugins/jeditable/jquery.jeditable.js"></script>

    <!-- Data Tables -->
    <script src="js/plugins/dataTables/jquery.dataTables.js"></script>
    <script src="js/plugins/dataTables/dataTables.bootstrap.js"></script>

    <!-- 自定义js -->
    <script src="js/content.js?v=1.0.0"></script>


    <!-- Page-Level Scripts -->
    <script>

       function par(a) {
           var competencename = $(a).val();

           var roleid = $("[name=roleid]").val();

           $.ajax({
               type: 'POST',
               url: 'wl_user_competence_insertordelete',
               data: {
                   roleid: roleid,
                   userid: competencename
               },
               dataType: 'json',
               success: function (data) {
                   if (data > 0) {
                       window.location.href = "wl_user_role_competences_getbyid?id=" + roleid;
                       return;
                   }

               },
               error: function (err) {
                   alert('出现故障');
               }
           });
       }

        $(document).ready(function () {

            $('.dataTables-example').dataTable();

            /* Init DataTables */
            var oTable = $('#editable').dataTable();

            /* Apply the jEditable handlers to the table */
            oTable.$('td').editable('../example_ajax.php', {
                "callback": function (sValue, y) {
                    var aPos = oTable.fnGetPosition(this);
                    oTable.fnUpdate(sValue, aPos[0], aPos[1]);
                },
                "submitdata": function (value, settings) {
                    return {
                        "row_id": this.parentNode.getAttribute('id'),
                        "column": oTable.fnGetPosition(this)[2]
                    };
                },

                "width": "90%",
                "height": "100%"
            });


        });

        function fnClickAddRow() {
            $('#editable').dataTable().fnAddData([
                "Custom row",
                "New row",
                "New row",
                "New row",
                "New row"]);

        }
    </script>

    <script type="text/javascript" src="http://tajs.qq.com/stats?sId=9051096" charset="UTF-8"></script>
    <!--统计代码，可删除-->

</body>

</html>
